#define _CRT_SECURE_NO_WARNINGS 1 
#include<stdio.h>
#include<stdlib.h>
typedef struct TreeNode {
	char val;
	struct TreeNode* left;
	struct TreeNode* right;
}TreeNode;

TreeNode* CreatTree(char* str,int* pi) {
	if (str[*pi] == '#') {
		(*pi)++;
		return NULL;
	}
	TreeNode* root = (TreeNode*)malloc(sizeof(TreeNode));	
	root->val = str[*pi];
	(*pi)++;
	root->left=CreatTree(str, pi);
	root->right=CreatTree(str, pi);
	return root;
}
void InOrderTree(TreeNode* root) {
	if (root == NULL) {
		return;
	}
	InOrderTree(root->left);
	printf("%c ", root->val);
	InOrderTree(root->right);
}
int main() {
	char str[100] = { 0 };
	scanf("%s", str);
	int i = 0;
	TreeNode* root = CreatTree(str, &i);
	InOrderTree(root);
	return 0;
}
